package com.web.exiaodao.remote.service;

import com.web.exiaodao.business.entity.ShopCar;
import com.web.exiaodao.remote.vo.ShopCarVo;
import com.web.webstart.base.util.result.XaResult;
import com.web.webstart.base.exception.BusinessException;
import org.springframework.data.domain.Page;

import java.util.List;

/**
 * 购物车不占库存,只有购物车下单的时候才实际占用库存
 */
public interface ApiShopCarService {
        /**
         * 购物车列表
         * @param userId
         * @return
         */
        public XaResult<Page<ShopCarVo>> findMyCar(Long userId, Integer begin, Integer count) throws BusinessException;

        /**
         * 获取购物车总数量
         * @param userId
         * @return
         * @throws BusinessException
         */
        public XaResult<Long> findMyCarCount(Long userId) throws BusinessException;

        /**
         * 加入购物车
         * @param shopCar
         * @return
         */
        public XaResult<ShopCarVo> addCar(ShopCar shopCar) throws BusinessException;

        /**
         * 修改购物车数量
         * @param shopCar
         * @return
         */
        public XaResult<List<ShopCarVo>> modifyCar(String shopCar) throws BusinessException;
        /**
         * 删除购物车
         * @param ids
         * @param userId
         * @return
         */
        public XaResult<ShopCarVo> deleteCar(String ids,Long userId) throws BusinessException;

        /**
         * 删除购物车里面无效的商品
         * @return
         */
        public void deleteInvalidCar() throws BusinessException;
}
